/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * Licensed under Simplified BSD License
 *
 *
 * @Original Author: jin Chen
 * @date: Apr 11, 2005$
 * @version: 1.0
 */
package edu.psu.geovista.app.visualclassifier.classify.v2.control;

import edu.psu.geovista.app.visualclassifier.classify.v2.DefaultESVisualClassifier;

import java.awt.*;

public abstract class BasicColorInvertor implements ColorInvertor{
     protected DefaultESVisualClassifier vc;

    protected BasicColorInvertor(DefaultESVisualClassifier vc) {
        this.vc = vc;
    }

     public abstract void invertColor() ;
    /**************************************************
        *                invert color
        ****************************************************/


       public static Color[] invertColor(Color[] src){

           Color[] dest=new Color[src.length ];
           for (int i=0;i<dest.length ;i++){
               int j=dest.length -i-1;
               dest[j]=src[i];
           }
           return dest;
       }
       public static Color[][] invertColorAlongColumn(Color[][] src){
           int row = src.length;
           int column = src[0].length;
           Color[][] dest=new Color[row][column];
           for (int i=0;i<dest.length ;i++){
               int j=dest.length -i-1;
               dest[j]=src[i];
           }
           return dest;

       }

        public static Color[][] invertBiColorAlongRow(Color[][] src){
           int row = src.length;
           int column = src[0].length;
           Color[][] dest=new Color[row][column];
           for (int i=0;i<src.length ;i++){
               Color[] arow=src[i];
               Color[] inversedRow=invertColor(arow);
               dest[i]=inversedRow;
           }
           return dest;
        }

}
